﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Sector7.Restaurant.EntityType;

namespace Sector7.Restaurant.Contracts
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码和配置文件中的接口名“LocalContract”。
    [ServiceContract]
    public interface LocalContract
    {
        #region SystemService
        /// <summary>
        /// 登录系统
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        [OperationContract]
        RS_Employee LoginSystem(string userName, string password);
        #endregion

        #region UnitService
        [OperationContract]
        int AddUnit(RS_Unit unit);

        [OperationContract]
        List<RS_Unit> GetAllUnits();

        [OperationContract]
        int SetUnit(EntityDelta delta);
        #endregion

        #region MetadataService
        /// <summary>
        /// 添加元数据
        /// </summary>
        /// <param name="metadata">元数据</param>
        /// <returns></returns>
        [OperationContract]
        int AddMetadata(RS_Metadata metadata);

        /// <summary>
        /// 修改元数据信息
        /// </summary>
        /// <param name="delta">改变量</param>
        /// <returns></returns>
        [OperationContract]
        int SetMetadata(EntityDelta delta);

        /// <summary>
        /// 根据使用范围和拼音缩写码获取所有元数据
        /// </summary>
        /// <param name="usage">使用范围</param>
        /// <returns></returns>
        [OperationContract]
        List<RS_Metadata> GetAllMetadatasForUsage(int usage);
        #endregion

        #region MetadataTypeService
        /// <summary>
        /// 创建元数据类型
        /// </summary>
        /// <param name="type">元数据类型</param>
        /// <returns></returns>
        [OperationContract]
        int AddMetadataType(RS_MetadataType type);

        /// <summary>
        /// 获取所有元数据类型
        /// </summary>
        /// <param name="isGreedy">是否启用贪婪加载</param>
        /// <returns></returns>
        [OperationContract]
        List<RS_MetadataType> GetAllMetadataTypes(bool isGreedy);

        /// <summary>
        /// 获取指定用途所有元数据类型
        /// </summary>
        /// <param name="usage">指定用途</param>
        /// <param name="isGreedy">是否启用贪婪加载</param>
        /// <returns></returns>
        [OperationContract]
        List<RS_MetadataType> GetAllMetadataTypesForUsage(int usage, bool isGreedy);

        /// <summary>
        /// 修改元数据类型
        /// </summary>
        /// <param name="delta">变化量</param>
        /// <returns></returns>
        [OperationContract]
        int SetMetadataType(EntityDelta delta);
        #endregion

        #region EmployeeService
        /// <summary>
        /// 添加员工
        /// </summary>
        /// <param name="employee">员工</param>
        /// <returns></returns>
        [OperationContract]
        long AddEmployee(RS_Employee employee);

        /// <summary>
        /// 修改员工
        /// </summary>
        /// <param name="employee">员工修改信息</param>
        /// <returns></returns>
        [OperationContract]
        int SetEmployee(EntityDelta employeeDelta);
        #endregion

        #region EmployeeGroupService
        /// <summary>
        /// 添加员工组
        /// </summary>
        /// <param name="group">员工组</param>
        /// <returns></returns>
        [OperationContract]
        int AddEmployeeGroup(RS_EmployeeGroup group);

        /// <summary>
        /// 获取所有员工组
        /// </summary>
        /// <param name="isGreedy">是否启用贪婪加载</param>
        /// <returns></returns>
        [OperationContract]
        List<RS_EmployeeGroup> GetAllEmployeeGroups(bool isGreedy);

        /// <summary>
        /// 修改员工组
        /// </summary>
        /// <param name="delta">员工组改变量</param>
        /// <returns></returns>
        [OperationContract]
        int SetEmployeeGroup(EntityDelta delta);
        #endregion

        #region RoomService
        [OperationContract]
        int AddRoom(RS_Room room);

        [OperationContract]
        List<RS_Room> GetAllRooms(bool isGreedy);

        /// <summary>
        /// 修改包间信息
        /// </summary>
        /// <param name="delta">包间变化量</param>
        /// <returns></returns>
        [OperationContract]
        int SetRoom(EntityDelta delta);
        #endregion

        #region TableService
        /// <summary>
        /// 添加桌位信息
        /// </summary>
        /// <param name="table">桌位信息</param>
        /// <returns></returns>
        [OperationContract]
        int AddTable(RS_Table table);

        /// <summary>
        /// 获取所有桌位信息
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        List<RS_Table> GetAllTables();

        /// <summary>
        /// 更新桌位信息
        /// </summary>
        /// <param name="delta">桌位变化量</param>
        /// <returns></returns>
        [OperationContract]
        int SetTable(EntityDelta delta);
        #endregion

        #region MenuItemTypeService
        [OperationContract]
        List<RS_MenuItemType> GetAllMenuItemTypes(bool isGreedy);
        #endregion

        #region MenuItemLabelService
        /// <summary>
        /// 创建菜单项标签
        /// </summary>
        /// <param name="label">菜单项标签</param>
        /// <returns></returns>
        [OperationContract]
        int AddMenuItemLabel(RS_MenuItemLabel label);

        /// <summary>
        /// 获取所有菜单项标签
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        List<RS_MenuItemLabel> GetAllMenuItemLabels();

        /// <summary>
        /// 修改菜单项标签
        /// </summary>
        /// <param name="delta">改变量</param>
        /// <returns></returns>
        [OperationContract]
        int SetMenuItemLabel(EntityDelta delta);
        #endregion

        #region MenuItemService
        [OperationContract]
        string AddMenuItem(RS_MenuItem menuItem);

        [OperationContract]
        int SetMenuItem(EntityDelta delta);

        [OperationContract]
        RS_MenuItem GetMenuItem(string menuItemId);
        #endregion

        #region BillService
        /// <summary>
        /// 添加销售单信息
        /// </summary>
        /// <param name="bill">销售单信息</param>
        /// <returns></returns>
        [OperationContract]
        string AddSalesBill(RS_SalesBill bill);

        /// <summary>
        /// 添加采购单信息
        /// </summary>
        /// <param name="bill">采购单信息</param>
        /// <returns></returns>
        [OperationContract]
        string AddPurchaseBill(RS_PurchaseBill bill);

        /// <summary>
        /// 根据指定桌位获取销售单信息
        /// </summary>
        /// <param name="tableId">桌位编号</param>
        /// <returns></returns>
        [OperationContract]
        RS_SalesBill GetSalesBillForTable(int tableId);

        /// <summary>
        /// 修改销售单信息
        /// </summary>
        /// <param name="delta">改变量</param>
        /// <returns></returns>
        [OperationContract]
        int SetSalesBill(EntityDelta delta);
        #endregion

        #region ChargeService
        /// <summary>
        /// 添加费用信息
        /// </summary>
        /// <param name="charge">费用信息</param>
        /// <returns></returns>
        [Obsolete("暂不开放直接添加费用信息功能。", true)]
        int AddCharge(RS_Charge charge);

        /// <summary>
        /// 根据时间范围获取费用记录
        /// </summary>
        /// <param name="begin">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <returns></returns>
        [OperationContract]
        List<RS_Charge> GetAllChargesForRange(DateTime begin, DateTime end);
        #endregion

        #region CompanyService
        /// <summary>
        /// 创建公司信息
        /// </summary>
        /// <param name="company">公司信息</param>
        /// <returns></returns>
        [OperationContract]
        int AddCompany(S7_Company company);

        /// <summary>
        /// 获取公司信息
        /// </summary>
        /// <param name="uniqueId">公司唯一编号</param>
        /// <returns></returns>
        [OperationContract]
        S7_Company GetCompany(string uniqueId);

        /// <summary>
        /// 更新公司信息
        /// </summary>
        /// <param name="delta">公司信息改变量</param>
        /// <returns></returns>
        [OperationContract]
        int SetCompany(EntityDelta delta);
        #endregion

        /***********************/

        #region MenuItemService
        #endregion
    }
}